home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / fs / efs_sb.h.z / efs_sb.h
C/C++ Source or Header  |  1992-04-03  |  6KB  |  140 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *          Copyright (C) 1988, Silicon Graphics, Inc.          *
  4.  *                                      *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                      *
  11.  **************************************************************************/
  12.  
  13. #ifndef    __EFS_SB_
  14. #define    __EFS_SB_
  15.  
  16. #ident "$Revision: 3.13 $"
  17.  
  18. /*
  19.  * Structure of the extent filesystem superblock
  20.  */
  21.  
  22. /*
  23.  * Software summary structure per cylinder group.  When a filesystem is
  24.  * mounted, the system builds a cylinder group table for containing summary
  25.  * allocation information.
  26.  */
  27. struct    cg {
  28.     daddr_t    cg_firstbn;        /* first bn in cg */
  29.     daddr_t    cg_firstdbn;        /* first data block bn */
  30.     ino_t    cg_firsti;        /* first inode # in cg */
  31.  
  32.     /*
  33.      * Inode allocation summary information.  We keep a simple rotor
  34.      * which tracks the lowest free inode for a given cg.
  35.      * We also keep a 'generation number' to control updating of this:
  36.      * if, during the search, an ifree occurred while we had reliquished
  37.      * the fs_semlock, our info is no longer up to date so we should
  38.      * not advance it.
  39.      */
  40.     ino_t    cg_lowi;        /* lowest inode # that's free */
  41.     unsigned cg_gen;
  42.  
  43.     /*
  44.      * Data allocation summary information.  When the cg is scanned,
  45.      * we build up information about the total number of free data
  46.      * blocks, as well the first free data block.
  47.      */
  48.     long    cg_dfree;        /* count of free data blocks */
  49.     daddr_t    cg_firstdfree;        /* first free data bn */
  50. };
  51.  
  52. /* structure of the super-block for the extent filesystem */
  53. struct efs {
  54.     /*
  55.      * This portion is read off the volume
  56.      */
  57.     long    fs_size;    /* size of filesystem, in sectors */
  58.     long    fs_firstcg;    /* bb offset to first cg */
  59.     long    fs_cgfsize;    /* size of cylinder group in bb's */
  60.     short    fs_cgisize;    /* bb's of inodes per cylinder group */
  61.     short    fs_sectors;    /* sectors per track */
  62.     short    fs_heads;    /* heads per cylinder */
  63.     short    fs_ncg;        /* # of cylinder groups in filesystem */
  64.     short    fs_dirty;    /* fs needs to be fsck'd */
  65.     time_t    fs_time;    /* last super-block update */
  66.     long    fs_magic;    /* magic number */
  67.     char    fs_fname[6];    /* file system name */
  68.     char    fs_fpack[6];    /* file system pack name */
  69.     long    fs_bmsize;    /* size of bitmap in bytes */
  70.     long    fs_tfree;    /* total free data blocks */
  71.     long    fs_tinode;    /* total free inodes */
  72.     long    fs_bmblock;    /* bitmap location. */
  73.     long    fs_replsb;    /* Location of replicated superblock. */
  74.     char    fs_spare[24];    /* space for expansion - MUST BE ZERO */
  75.     long    fs_checksum;    /* checksum of volume portion of fs */
  76.  
  77.     /*
  78.      * The remainder is used for in-core manipulation.  During
  79.      * super-block creation, and possible writing in the root's case,
  80.      * these fields will be written to disk.  It is assumed when
  81.      * the super-block is read in that these fields contain trash,
  82.      * and are accordingly initialized.
  83.      */
  84.     char    fs_readonly;    /* device is read-only */
  85.     char    fs_fmod;    /* filesystem has been modified */
  86.     char    fs_corrupted;    /* fs is corrupted; no more write's */
  87.     char    fs_freedblock;    /* freed a block so disk may not be diskfull */
  88.     long    fs_diskfull;    /* had to do a brute search for data blocks */
  89.     dev_t    fs_dev;        /* device fs is mounted on */
  90.  
  91.     short    fs_inopchunk;    /* # of inodes in an inode chunk */
  92.     daddr_t    fs_inopchunkbb;    /* # of bb's in an inode chunk, rounded up */
  93.     short    fs_minfree;    /* min # of free blocks for file placement */
  94.     short    fs_mindirfree;    /* min # of free blocks for dir placement */
  95.     ino_t    fs_ipcg;    /* # of inodes per cg */
  96.     ino_t    fs_lastinum;    /* last inum in fs */
  97.     ushort    fs_lbshift;    /* logical block shift */
  98.     struct    sema_s *fs_semlock;    /* file system semaphore */
  99.  
  100.     /*
  101.      * An array of cg structs is managed here.  During mounting
  102.      * the size of this structure plus the number of cg structs
  103.      * that will be needed, minus 1 (because of the one defined below),
  104.      * is dynamically allocated.  This makes it easy to do quick looking
  105.      * through the cg structs for allocation/de-allocation.
  106.      */
  107.     struct    cg fs_cgs[1];    /* actually, there are more here */
  108. };
  109.  
  110. #define    EFS_MAGIC    0x072959L
  111.  
  112. /* IRIX 3.3 filesystems need a new
  113.  * magic number to ensure there's no attempt to (disasterously!) use
  114.  * them on a pre-3.3 system.
  115.  */
  116.  
  117. #define EFS_NEWMAGIC    0x07295a
  118. #define IS_EFS_MAGIC(x)    ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC))
  119.  
  120. /*
  121.  * Values for fs_dirty.  If a filesystem was cleanly unmounted, and started
  122.  * clean before being mounted then fs_dirty will be EFS_CLEAN.  Otherwise,
  123.  * the filesystem is suspect in one of several ways.  If it was a root
  124.  * filesystem and had to be mounted even though it was dirty, the fs_dirty
  125.  * flag gets set to EFS_ACTIVEDIRT so that user level tools know to
  126.  * clean the root filesystem.  If the filesystem was clean and is mounted,
  127.  * then the fs_dirty flag gets set to EFS_ACTIVE.  EFS_DIRTY is a particular
  128.  * value to assign fs_dirty to when a filesystem is known to be dirty.
  129.  */
  130. #define    EFS_CLEAN    0x0000        /* unmounted && clean */
  131. #define    EFS_ACTIVEDIRT    0x0BAD        /* mounted a dirty fs (root only) */
  132. #define    EFS_ACTIVE    0x7777        /* mounted && clean */
  133. #define    EFS_DIRTY    0x1234        /* random value for dirtyness */
  134.  
  135. #ifdef _KERNEL
  136. #define    efs_getfs(mp)    ((struct efs *) (mp)->m_bufp)
  137. #endif
  138.  
  139. #endif    /* __EFS_SB_ */
  140.